//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using System.ComponentModel;
using System.Workflow.ComponentModel;
using System.Xml;


namespace Microsoft.Research.ScientificWorkflow.Activities
{
    [Name("Xsl Transformer")]
    [Description("Transforms an Xml file using an Xsl file into another Xml file")]
    [WorkflowCategory("Utilities")]
    public partial class XslTransform : System.Workflow.ComponentModel.Activity
    {
        #region Property Definitions
        // Required Input Property
        public static DependencyProperty InputXmlProperty =
            DependencyProperty.Register("InputXml", typeof(XmlDocument), typeof(XslTransform));
        public static DependencyProperty InputXslProperty =
            DependencyProperty.Register("InputXsl", typeof(XmlDocument), typeof(XslTransform));
        // Output Property
        public static DependencyProperty OutputXmlProperty =
            DependencyProperty.Register("OutputXml", typeof(XmlDocument), typeof(XslTransform));

        [RequiredInputParam]
        [Name("Input XML")]
        [Description("The XML file to transform")]
        public XmlDocument InputXml
        {
            get { return ((XmlDocument)(base.GetValue(XslTransform.InputXmlProperty))); }
            set { base.SetValue(XslTransform.InputXmlProperty, value); }
        }

        [RequiredInputParam]
        [Name("XSL Transform")]
        [Description("The XSL file defining the transformation")]
        public XmlDocument InputXsl
        {
            get { return ((XmlDocument)(base.GetValue(XslTransform.InputXslProperty))); }
            set { base.SetValue(XslTransform.InputXslProperty, value); }
        }

        [OutputParam]
        [Name("Output XML")]
        [Description("The transformed XML")]
        public XmlDocument OutputXml
        {
            get { return ((XmlDocument)(base.GetValue(XslTransform.OutputXmlProperty))); }
        }
        #endregion

        public XslTransform()
		{
			//InitializeComponent();
		}

        /// <summary>
        /// Opens a stream on the input file 
        /// </summary>
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            return ActivityExecutionStatus.Closed;
        }
	}
}
